#@adminLayout() #define main()

<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form-edit" >
			<input id="ccode" name="ccode"  type="hidden"  />
			<div class="form-group">
				<label class="col-sm-2 control-label">菜单名：</label>
				<div class="col-sm-10">
					<input type="text" name="cname" class="form-control" required maxlength="100"/>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">菜单描述：</label>
				<div class="col-sm-10">
					<input type="text" name="cdesc" class="form-control" maxlength="200"/>
				</div>
			</div>
			 <!-- <div class="form-group">
				<label class="col-sm-2 control-label">图标：</label>
				<div class="col-sm-10">
					<input id="icon" name="icon" class="form-control" type="text" placeholder="选择图标" >
                    <div class="ms-parent" style="width: 100%;">
                        <div class="icon-drop animated flipInX" style="display: none;max-height:200px;overflow-y:auto">
                            #include("font_icon.html")
                        </div>
                    </div>
				</div>
			</div>  -->
			<div class="form-group">
				<label class="col-sm-2 control-label">菜单路径</label>
				<div class="col-sm-10">
					<input type="text" name="cprg" class="form-control" required maxlength="255"/>
				</div>
			</div>
			
			<div class="form-group">
				<label class="col-sm-2 control-label">菜单目录</label>
				<div class="col-sm-10">
					<!-- <input type="text" id="cclass2" name="cclass2" class="form-control" required maxlength="10"/> -->
					
					<div class="input-group">
						<input type="hidden" name="cclass2" id="cclass2" >
						<input class="form-control" type="text" name="cclass2name" id="cclass2name" onclick="selectClass2Tree()">
						<span class="input-group-addon"  onclick="selectClass2Tree()"><i class="fa fa-search"></i></span>
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">CS菜单路径</label>
				<div class="col-sm-10">
					<input type="text" name="cprg_cs" class="form-control" />
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">弹框设置</label>
				<div class="col-sm-10">
					<select class="form-control" name="ctarger">
						<option value="1">tab内部</option>
						<option value="2">新窗口</option>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">菜单序号：</label>
				<div class="col-sm-4">
					<input type="number" name="isort" class="form-control" required maxlength="22"/>
				</div>
				<label class="col-sm-2 control-label">是否启用</label>
				<div class="col-sm-4" style="padding-top:7px;">
					<input type="checkbox" name="st_flag" value="1"/>
				</div>
			</div>
			<!-- <div class="form-group">
				<label class="col-sm-2 control-label"></label>
				<div class="col-sm-10">
					<input type="text" name="cwk_type" class="form-control" required maxlength="10"/>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label"></label>
				<div class="col-sm-10">
					<input type="text" name="ctarger" class="form-control" required maxlength="1"/>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label"></label>
				<div class="col-sm-10">
					<input type="text" name="bc_flag" class="form-control" required maxlength="4"/>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label"></label>
				<div class="col-sm-10">
					<input type="text" name="user_flag" class="form-control" required maxlength="1"/>
				</div>
			</div> -->
			
		</form>
	</div>
	<script type="text/javascript">
		var prefix = "#(ctx)/sysmenu";
		var ccode='#(ccode)';
		var cclass2='#(cclass2)';
    	$(function(){
    		/* $("input[name='icon']").focus(function() {
                $(".icon-drop").show();
            }); */
            /* $("#form-edit").click(function(event) {
                var obj = event.srcElement || event.target;
                if (!$(obj).is("input[name='icon']")) {
                    $(".icon-drop").hide();
                }
            });
            //console.log($(".icon-drop").find(".code-name").text());
            $(".icon-drop").find(".dib span").on("click",
            function() {
            	console.log($(this).attr('class'));
            	$('#icon').val($(this).attr('class').replace('icon ',''));
            }); */

			$('#form-edit').loadForm(prefix+'/getData?ccode='+ccode);
    		$('#ccode').val(ccode);
    		if(cclass2!='')
    		{
        		$('#cclass2').val(cclass2);
    		}
    	});
    	
		function submitHandler() {
	        if ($.validate.form()) {
	        	$.operate.save(prefix + "/save", $('#form-edit').serialize());
	        }
	    }
		
		function selectClass2Tree()
		{
            var url = "#(ctx)/sysmenu/select";
		    var options = {
				title: '选择目录',
				width: "380",
				url: url
			};
			//$.modal.openOptions(options);
			openWin("选择目录",url,380);
		}
		
		function doSubmit(treeId, treeName){
   			$("#cclass2").val(treeId);
   			$("#cclass2name").val(treeName);
		}
	</script>
</body>
#end
